﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Model;

namespace BusinnessLogic
{
    public class ManageTeam
    {
        public List<Team> PopulateTeamlist()
        {
            DataLayer.dlteams DLteamlistfiller = new DataLayer.dlteams();
            DataSet dts = DLteamlistfiller.TeamList();

            List<Team> teamlist = new List<Team>();


            for (int i = 0; i < dts.Tables[0].Rows.Count; i++)
            {
                 int userid = int.Parse(dts.Tables[0].Rows[i]["UserID"].ToString());
                 int teamid = int.Parse(dts.Tables[0].Rows[i]["TeamID"].ToString());
                // string login = dts.Tables[0].Rows[i]["Login"].ToString();
                // string passwoord = dts.Tables[0].Rows[i]["Passwoord"].ToString();
              
                 string name = dts.Tables[0].Rows[i]["Name"].ToString();
                // string voornaam = dts.Tables[0].Rows[i]["FirstName"].ToString();
                // string rolnaam = dts.Tables[0].Rows[i]["Role"].ToString();

                Team newteam = new Team(teamid, name, userid);
                teamlist.Add(newteam);


            }
            return teamlist;
        }
    }
}
